// @switch-prefix-cls: ~"@{css-prefix}switch";

// .@{switch-prefix-cls} {
//   display: inline-block;
//   width: 44px;
//   height: 22px;
//   line-height: 20px;
//   border-radius: 22px;
//   vertical-align: middle;
//   border: 1px solid #ccc;
//   background-color: #ccc;
//   position: relative;
//   cursor: pointer;
//   user-select: none;
//   transition: all @transition-time @ease-in-out;

//   // hover
//   &:not(&-checked):hover{
//     background-color: rgba(51, 125, 255, 0.3000);
//   }
//   &-disabled&-default:not(&-checked):hover{
//     background-color: #ccc;
//   }
//   &-loading{
//     opacity: .4;
//   }

//   &-inner {
//     color: #fff;
//     font-size: @font-size-base;
//     position: absolute;
//     left: 23px;

//     i {
//       width: 12px;
//       height: 12px;
//       text-align: center;
//       position: relative;
//       top: -1px;
//     }
//   }

//   &:after {
//     content: '';
//     width: 18px;
//     height: 18px;
//     border-radius: 18px;
//     background-color: #fff;
//     position: absolute;
//     left: 1px;
//     top: 1px;
//     cursor: pointer;
//     transition: left @transition-time @ease-in-out, width @transition-time @ease-in-out;
//   }

//   &:active:after {
//     width: 26px;
//   }

//   &:before{
//     content: '';
//     display: none;
//     width: 14px;
//     height: 14px;
//     border-radius: 50%;
//     background-color: transparent;
//     position: absolute;
//     left: 3px;
//     top: 3px;
//     z-index: 1;
//     border: 1px solid @color-brand-primary;
//     border-color: transparent transparent transparent @color-brand-primary;
//     animation: switch-loading 1s linear;
//     animation-iteration-count: infinite;
//   }
//   &-loading:before{
//     display: block;
//   }

//   &:not(&-disabled):focus {
//     box-shadow: 0 0 0 2px fade(@color-brand-primary, 20%);
//     outline: 0;
//   }

//   &:focus:hover {
//     //box-shadow: none;
//   }

//   &-small {
//     width: 28px;
//     height: 16px;
//     line-height: 14px;
//     &:after {
//       width: 12px;
//       height: 12px;
//     }
//     &:active:after {
//       width: 14px;
//     }
//     &:before{
//       width: 10px;
//       height: 10px;
//       left: 2px;
//       top: 2px;
//     }
//   }

//   &-small&-checked:after {
//     left: 13px;
//   }
//   &-small&-checked:before {
//     left: 14px;
//   }

//   &-small:active&-checked:after {
//     left: 11px;
//   }

//   &-large{
//     width: 56px;
//     &:active:after {
//       width: 26px;
//     }
//   }

//   &-large:active:after {
//     width: 30px;
//   }

//   &-large&-checked:after {
//     left: 35px;
//   }
//   &-large&-checked:before {
//     left: 37px;
//   }

//   &-large:active&-checked:after {
//     left: 23px;
//   }

//   &-checked {
//     border-color: @color-brand-primary;
//     background-color: @color-brand-primary;

//     .@{switch-prefix-cls}-inner {
//       left: 7px;
//     }

//     &:after {
//       left: 23px;
//     }
//     &:before{
//       left: 25px;
//     }

//     &:active:after {
//       left: 15px;
//     }
//   }

//   &-disabled {
//     cursor: @cursor-disabled;
//     opacity: .4;

//     &:after {
//       background: #fff;
//       cursor: not-allowed;
//     }

//     .@{switch-prefix-cls}-inner {
//       color: #fff;
//     }
//     // &:hover{
//     //   background-color: inherit;
//     // }
//   }

//   &-disabled&-checked{
//     border-color: @color-brand-primary;
//     background-color: @color-brand-primary;
//     opacity: .4;

//     &:after {
//       background: #fff;
//     }

//     .@{switch-prefix-cls}-inner {
//       color: #fff;
//     }
//   }

// }

// @keyframes switch-loading {
//   0% {
//     transform: rotate(0);
//   }
//   100% {
//     transform: rotate(360deg);
//   }
// }

@switch-prefix-cls: ~'@{css-prefix}switch';

.@{switch-prefix-cls} {
  display: inline-block;
  width: 44px;
  height: 22px;
  line-height: 20px;
  border-radius: 22px;
  vertical-align: middle;
  background-color: @color-icon-disable;
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: all @transition-time @ease-in-out;

  // hover
  &:not(&-checked):hover {
    background-color: @switch-not-checked-hover;
  }
  &-disabled&-default:not(&-checked):hover {
    background-color: @color-complementary-22;
  }
  &-loading {
    opacity: 0.4;
  }

  &-inner {
    color: @color-functional-white;
    font-size: @font-size-base;
    position: absolute;
    // left: 23px;
    right: 7px;

    i {
      width: 12px;
      height: 12px;
      text-align: center;
      position: relative;
      top: -0.125em;
    }
  }

  &:after {
    content: '';
    width: 18px;
    height: 18px;
    border-radius: 18px;
    background-color: @color-functional-white;
    position: absolute;
    left: 1px;
    top: 1px;
    cursor: pointer;
    transition: left @transition-time @ease-in-out,
      width @transition-time @ease-in-out;
  }

  &:active:after {
    width: 26px;
  }

  &:before {
    content: '';
    display: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: transparent;
    position: absolute;
    left: 3px;
    top: 3px;
    z-index: 1;
    border: 2px solid @color-brand-primary;
    border-color: transparent transparent transparent @color-brand-primary;
    animation: switch-loading 1s linear;
    animation-iteration-count: infinite;
  }
  &-loading:before {
    display: block;
  }

  &:not(&-disabled):focus {
    box-shadow: 0 0 0 2px fade(@color-brand-primary, 20%);
    outline: 0;
  }

  &:focus:hover {
    //box-shadow: none;
  }

  &-small {
    width: 42px;
    height: 22px;
    border-radius: 14px;
    line-height: 22px;
    display: inline-block;
    line-height: 20px;
    vertical-align: middle;
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: all @transition-time @ease-in-out;
    &:after {
      content: '';
      width: 18px;
      height: 18px;
      border-radius: 18px;
      background-color: @color-functional-white;
      position: absolute;
      left: 2px;
      top: 2px;
      cursor: pointer;
      transition: left 0.2s ease-in-out, width 0.2s ease-in-out;
    }
    &:active:after {
      width: 14px;
    }
    &:before {
      width: 16px;
      height: 16px;
      left: 1px;
      top: 2px;
    }
    .haloe-switch-inner{
      // position: absolute;
      line-height:20px;
      // right:7px
    }
  }

  &-small&-checked:after {
    left: 22px;
  }
  &-small&-checked:before {
    left: 23px;
  }

  &-small:active&-checked:after {
    left: 11px;
  }

  &-large {
    width: 54px;
    height: 28px;
    border-radius: 14px;
    line-height: 26px;
    display: inline-block;
    line-height: 20px;
    vertical-align: middle;
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: all @transition-time @ease-in-out;
    &:after {
      content: '';
      width: 24px;
      height: 24px;
      border-radius: 24px;
      background-color: @color-functional-white;
      position: absolute;
      left: 2px;
      top: 2px;
      cursor: pointer;
      transition: left 0.2s ease-in-out, width 0.2s ease-in-out;
    }
    &:active:after {
      width: 26px;
    }
    .haloe-switch-inner{
      // position: absolute;
      line-height:24px;
      // right:7px
    }
  }

  &-large:active:after {
    width: 30px;
  }

  &-large&-checked:after {
    left: 28px;
  }
  &-large&-checked:before {
    left: 29px;
  }

  &-large:active&-checked:after {
    left: 23px;
  }
  &-large:before{
    width: 22px;
    height: 22px;
    top: 2px;
    left:1px;
  }

  &-checked {
    border-color: @color-brand-primary;
    background-color: @color-brand-primary;

    .@{switch-prefix-cls}-inner {
      left: 7px;
    }

    &:after {
      left: 23px;
    }
    &:before {
      left: 25px;
    }

    &:active:after {
      left: 15px;
    }
    &:hover{
      background-color: @color-brand-hover;
    }
  }

  &-disabled {
    cursor: @cursor-disabled;
    opacity: 0.4;

    &:after {
      background: @color-functional-white;
      cursor: not-allowed;
    }

    .@{switch-prefix-cls}-inner {
      color: @color-functional-white;
    }
    // &:hover{
    //   background-color: inherit;
    // }
  }

  &-disabled&-checked {
    border-color: @color-brand-primary;
    background-color: @color-brand-primary;
    opacity: 0.4;

    &:after {
      background: @color-functional-white;
    }

    .@{switch-prefix-cls}-inner {
      color: @color-functional-white;
    }
  }
}

@keyframes switch-loading {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}
